<?php 
include_once 'functions.php';
////////////////////////////////////////////////////////////////////////////////////////
//																		   RUN FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////
$getStudent = getStudent();
$getBranchingQuestion = getBranchingQuestion();
////////////////////////////////////////////////////////////////////////////////////////
//																HANDLE ANSWER SUBMISSION
////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['submitter']))
{
$selectedAnswer = $_POST['questionOptions'];

   $checkAnswer = checkAnswer();
    $correctAnswer = $checkAnswer[0][0];
    if ($selectedAnswer == $correctAnswer) {
		        $score = ($_POST['score']+1);
        $_SESSION['correct'][]= $selectedAnswer;
		 $correct = $_SESSION['correct'];	
		
		$feedbackStatus = "<span class='green'> correct.</span>";
        } 
		
		else {
        $feedbackStatus = "<span class='red'> incorrect</span>, the correct answer was $correctAnswer.";
        $_SESSION['incorrect'][] = $selectedAnswer;
        $score = ($_POST['score']); 
		}

if (isset($_POST['solicitFeedback']))
{
    $num = $_POST['num'];
   $score = $_POST['score'];
	$_SESSION['score'] = $_POST['score']; 

}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="styles/styles.css" type="text/css" />
<title>mcq</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="scripts/scripts.js"></script>
</head>
<body>
<?php   if ($getBranchingQuestion) {
		$questionID = $getBranchingQuestion[0][0];
		$questionStem = $getBranchingQuestion[0][1];
		$option1 = $getBranchingQuestion[0][2];
		$option2 = $getBranchingQuestion[0][3];
		$option3 = $getBranchingQuestion[0][4];
		$option4 = $getBranchingQuestion[0][5];
		$resource = $getBranchingQuestion[0][7];

} ?>

<div id="container">
   <header>
<nav>
<?php include 'nav.php' ?>
</nav>

</header>  <div id="mainContent">
 
    <div class="q-stem">
          <p id="itemStem">
            <?php echo $questionStem ?>
          </p>
        </div>
        <div>
          <input name="questionOptions" id="radio1" type="radio" value="<?php echo $option1 ?>">
          <label id="label1" for="radio1">
            <?php echo $option1 ?>
          </label>
        </div>
        <div>
          <input name="questionOptions" id="radio2" type="radio" value="<?php echo $option2 ?>">
          <label id="option2" for="radio2">
            <?php echo $option2 ?>
          </label>
        </div>
        <div>
          <input name="questionOptions" id="radio3" type="radio" value="<?php echo $option3 ?>">
          <label id="option3" for="radio3">
            <?php echo $option3 ?>
          </label>
        </div>
        <div>
          <input name="questionOptions" id="radio4" type="radio" value="<?php echo $option4 ?>">
          <label id="option4" for="radio4">
            <?php echo $option4 ?>
          </label>
        </div>




    <!--mainContent--> 
  </div>
  <!--quiz--> 
</div>
<!--container-->
</body>
</html>